What is the most obfuscated and clever code you've seen? [closed]
Posted
by ThibThib
on Stack Overflow
See other posts from Stack Overflow
or by ThibThib
Published on 2009-07-24T13:54:29Z
Indexed on
2010/03/29
12:43 UTC
Read the original article
Hit count: 182
I am aware about the The International Obfuscated C Code Contest, but I am looking for obfuscated AND clever codes (specially short ones)
Here is two examples (the first one is a classical one, I think)
#define _ F-->00 || F-OO--;
long F=00,OO=00;
main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO()
{
_-_-_-_
_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_
_-_-_-_
}
and
#include <unistd.h>
float o=0.075,h=1.5,T,r,O,l,I;int _,L=80,s=3200;main(){for(;s%L||
(h-=o,T= -2),s;4 -(r=O*O)<(l=I*I)|++ _==L&&write(1,(--s%L?_<L?--_
%6:6:7)+"World! \n",1)&&(O=I=l=_=r=0,T+=o /2))O=I*2*O+h,I=l+T-r;}
I let you compile and run them so as to understand what they are producing.
Of course, I am not looking for only obfuscated code, because I guess that every code could be transformed in a way that it is not readable at all
I am more looking for small codes that you can eventually understand, with some clever tricks. I will show them to my students as example of clever things that they should not do (it's always better to show clever examples rather than stupid ones...)
Thanks
© Stack Overflow or respective owner